package com.cyzy.service.serviceImpl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cyzy.domin.TClassify;
import com.cyzy.domin.TClassifyTwo;
import com.cyzy.dto.ResponseData;
import com.cyzy.service.TClassifyService;
import com.cyzy.mapper.TClassifyMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;

/**
* @author Liu
* @description 针对表【t_classify】的数据库操作Service实现
* @createDate 2024-11-14 11:46:21
*/
@Service
public class TClassifyServiceImpl extends ServiceImpl<TClassifyMapper, TClassify>
    implements TClassifyService{

    @Autowired
    private TClassifyMapper tClassifyMapper;

    // 一级菜单查询
    @Override
    public ResponseData getClassifyById(TClassify tClassify) {
        List<TClassify> tClassifyList = new ArrayList<>();
        try {
             tClassifyList = tClassifyMapper.selectClassifyById(tClassify);
        }catch (Exception e){
            return ResponseData.no2("查询错误");
        }
        return ResponseData.ok2(tClassifyList);
    }

    // 二级菜单查询
    @Override
    public ResponseData getClassifyTwoById(TClassifyTwo tClassifyTwo) {
        List<TClassifyTwo> tClassifyTwoList = new ArrayList<>();
        try {
            tClassifyTwoList = tClassifyMapper.selectClassifyTwoById(tClassifyTwo);
            System.out.println("tClassifyTwoList:"+tClassifyTwoList);
        }catch (Exception e){
//            return ResponseData.no2("查询错误");
            return ResponseData.no2(e.getMessage());
        }
        return ResponseData.ok2(tClassifyTwoList);
    }
}




